<template>
	<div class="theme">
		<van-nav-bar left-text="返回" left-arrow @click-left="onClickLeft" />
		<div class="overlay headTop">
			<div class="overlay-content scrolling">
				<div style="padding: 5px 15px;">
					<div class="title" v-text="confirmPassword ? list.desc : list.title">2018金融风暴2018金融风暴2018金融风暴2018金融风暴</div>
					<div class="time">{{list.createTime | formatDate}}</div>
					<div class="center" v-html="confirmPassword ? list.value : list.content">
						0
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	let _this;
	import { home } from './../utils/api'
	import { formatDate } from './../utils/date';
	export default {
		name: 'Details',
		components: {},
		props: {},
		data() {
			return {
				list: [],
				confirmPassword: false,
			};
		},
		beforeCreate() {
			_this = this;
		},
		watch: {},
		computed: {},
		methods: {
			onClickLeft() {
				if(!this.confirmPassword) {
					this.$router.push({
						path: '/Information'
					});
				} else {
					this.$router.back(-1);
				}
			},
			getNoticetype() {
				this.axios.get(process.env.API_HOST + 'findtype/noticetype/' + this.$route.query.id).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data;
					}
				})
			},
			getConfirmPassword() {
				home.getConfirmPassword().then(res => {
					if(res.code == 200) {
						this.list = res.data;
					}
				})
			},
		},
		created() {},
		mounted() {
			this.confirmPassword = Number(this.$route.params.type) == 2;
			if(!this.confirmPassword) {
				this.getNoticetype();
			} else {
				this.getConfirmPassword();
			}
		},
		destroyed() {

		},
		filters: {
			formatDate(time) {
				let date = new Date(time);
				return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
			}
		}
	};
</script>

<style lang="less" scoped>
	/deep/ .van-nav-bar {
		background-color: #43add5;
	}
	
	/deep/ .van-nav-bar .van-icon {
		color: white;
	}
	
	/deep/ .van-nav-bar__title {
		color: white;
	}
	
	/deep/ .van-nav-bar__arrow {
		font-size: 18px;
	}
	
	/deep/ .van-nav-bar__text {
		color: white;
	}
	
	.title {
		letter-spacing: 0.5px;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		font-size: 15px;
		font-weight: 600;
	}
	
	.time {
		padding: 15px 0px;
		font-size: 12px;
		color: #7D7E80;
	}
	
	.center {
		letter-spacing: 0.5px;
		line-height: 20px;
		text-indent: 1em;
		font-size: 13px;
		color: #7D7E80;
	}
	
	/deep/ img{
		width: 100%;
		padding:6px 0;
	}
</style>